﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using EzDesk.EzAppApi.Utility.EzDeskAppApi;

namespace EzDesk.EzAppApi.Web.Utility.Extensions
{
    public static class HtmlExtension
    {
        public static string SimpleUserLabel(this HtmlHelper html, SimpleUser user, bool displayDept = false)
        {
            // todo: 在SimpleUser加入Dept内容后修改
            if (displayDept)
            {
                return 
                    string.Format(
                        "<a href=\"{0}\">{1}</a>(<a href=\"{2}\">{3}</a>)",
                        user.Id.ToString(),
                        user.Name,
                        user.Dept.Id,
                        user.Dept.DeptName
                        );
            }
            else
            {
                return string.Format("<a href=\"#{0}\">{1}</a>", user.Id.ToString(), user.Name);
            }
        }

        public static string SimpleGroupLabel(this HtmlHelper html, Group group)
        {
            return string.Format("<a href=\"#{0}\">{1}</a>", group.Id.ToString(), group.Description);
        }
    }

    
}
